[#321] Fix SDK royalty ABI/client and web app MCV2 ABI accuracy#326
[#321] Fix SDK royalty ABI/client and web app MCV2 ABI accuracy#326realproject7 merged 1 commit intomainfrom
Conversation
SDK fixes: - getRoyaltyInfo: inputs corrected to (wallet, reserveToken), outputs to (balance, claimed) matching MCV2_Royalty contract - claimRoyalties: input renamed to reserveToken; client now accepts reserve token address instead of storyline token - RoyaltyInfo type: unclaimed → balance + claimed fields CLI fixes: - claim command: passes reserveToken to getRoyaltyInfo/claimRoyalties - status command: passes bondReserveToken to getRoyaltyInfo Web app ABI fixes (lib/price.ts): - getReserveForToken: outputs now include royalty field - getRefundForTokens: outputs now include royalty field - mint/burn: outputs now include uint256 return value - TradingWidget/PriceChart: extract first tuple element from getReserveForToken/getRefundForTokens results Fixes #321 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
T2b APPROVE
Verified all changes against IMCV2_Bond.sol and MCV2_Royalty.sol contract source:
SDK ABI (packages/sdk/src/abi.ts):
getRoyaltyInfo: inputs(wallet, reserveToken), outputs(balance, claimed)— matches MCV2_Royalty ✅claimRoyalties: inputreserveToken— matches contract ✅
SDK client (packages/sdk/src/client.ts):
getRoyaltyInfo(beneficiary, reserveToken)arg order matches ABI ✅- Returns
{ balance, claimed }from tuple destructure ✅ claimRoyalties(reserveToken)accepts reserve token ✅
CLI (claim.ts, status.ts):
- Both commands pass
reserveToken(fromtokenBond()) instead of storyline token ✅ - Use
info.balanceinstead ofinfo.unclaimed✅
Web app ABI (lib/price.ts):
getReserveForToken/getRefundForTokens: addedroyaltyoutput ✅mint/burn: addeduint256return ✅- Royalty functions already correct in this file ✅
Components (TradingWidget.tsx, PriceChart.tsx):
- Both extract
[0]from new tuple return types — trading estimates preserved ✅
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
This PR fixes the SDK royalty ABI/client mismatch and updates the web app MCV2 ABI outputs to match the contract while preserving the existing trading estimate behavior. The changes are consistent with issue #321 and the checked IMCV2_Bond.sol interface.
Findings
- [low]
packages/sdk/src/abi.ts,packages/sdk/src/client.ts, and the CLI call sites now consistently use(beneficiary, reserveToken)forgetRoyaltyInfoandreserveTokenforclaimRoyalties.- File:
packages/sdk/src/client.ts:503 - Suggestion: None.
- File:
- [low] The
lib/price.tstuple output corrections are handled safely at the UI call sites by extracting the first tuple element, so price/refund estimates continue to use the reserve/refund amount.- File:
src/components/TradingWidget.tsx:68 - Suggestion: None.
- File:
Decision
Approve. The ABI shapes now match the contract, CLI royalty flows pass the reserve token correctly, and local npm run build plus npm run typecheck both pass.
Summary
packages/sdk/src/abi.ts): FixedgetRoyaltyInfoinputs to(wallet, reserveToken)with outputs(balance, claimed); renamedclaimRoyaltiesinput toreserveTokenpackages/sdk/src/client.ts):getRoyaltyInfo()now passes(beneficiary, reserveToken)in correct order and returns bothbalanceandclaimed;claimRoyalties()accepts reserve token addresspackages/cli/src/commands/claim.ts): PassesreserveToken(already available fromtokenBond()) to SDK methods instead of storyline tokenpackages/cli/src/commands/status.ts): HoistedbondReserveTokenfor royalty info calllib/price.ts): Added missingroyaltyoutput togetReserveForToken/getRefundForTokens; addeduint256return tomint/burnFixes #321
Test plan
npm run buildpassesnpm run typecheckpasses[0]from tuple)claimcommand works with reserve tokenstatuscommand displays royalty info